const {defineConfig} = require('@vue/cli-service')
console.log(process.env.NODE_ENV)
module.exports = defineConfig({
    transpileDependencies: true,
    publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
    configureWebpack: config => {
        config.optimization = {
            splitChunks: {
                chunks: 'all',
                cacheGroups: {
                    vue: {
                        name: 'vue',
                        test: /[\\/]node_modules[\\/]vue[\\/]/,
                        priority: -10
                    },
                    vuex: {
                        name: 'vuex',
                        test: /[\\/]node_modules[\\/]vuex[\\/]/,
                        priority: -10
                    },
                    'vue-router': {
                        name: 'vue-router',
                        test: /[\\/]node_modules[\\/]vue-router[\\/]/,
                        priority: -10
                    },
                    'element-ui': {
                        name: 'element-ui',
                        test: /[\\/]node_modules[\\/]element-ui[\\/]/,
                        priority: -10
                    },
                    'mavon-editor': {
                        name: 'mavon-editor',
                        test: /[\\/]node_modules[\\/]mavon-editor[\\/]/,
                        priority: -10
                    },
                    'vendors': {
                        name: 'vendors',
                        test: /[\\/]node_modules[\\/]/,
                        priority: -20
                    }
                }
            }
        }
    },
    devServer: {
        port: 2699
    }
})
